<!DOCTYPE html>
<html>
<head>
<script src="/jquery/jquery-1.7.2.js"></script>
<script src="js/LocalStorage.js"></script>
<script>

function updateResult() {
	$("#result").html(Number(LocalStorage.get("clickcount")));
}

function clickIncCounter() {
	var count = Number(LocalStorage.get("clickcount"));
	LocalStorage.set("clickcount", count + 1);

	updateResult();
}
function clickDecCounter() {
	var count = Number(LocalStorage.get("clickcount"));
	LocalStorage.set("clickcount", count - 1);

	updateResult();
}
function clickRemCounter() {
	LocalStorage.del("clickcount");

	updateResult();
}

$(document).ready(function() {
	updateResult();

	var o = { b:"", b:function() {} };
	LocalStorage.set("test", JSON.stringify(o));
});

</script>
</head>
<body>
<ul>
<li><button onclick="clickIncCounter()" type="button">Click me!</button></li>
<li><button onclick="clickDecCounter()" type="button">Click me!</button></li>
<li><button onclick="clickRemCounter()" type="button">Click me!</button></li>
</ul>
<div id="result"></div>
<p>Click the button to see the counter increase.</p>
<p>Close the browser tab (or window), and try again, and the counter will continue to count (is not reset).</p>
</body>
</html>
